import { ref, onMounted, watch } from 'vue'
const useTitle = () => {
  const title = ref()
  const initTitle = () => {
    title.value = document.title
  }
  watch(title, (val) => {
    document.title = val
    title.value = val
  })
  onMounted(() => {
    initTitle()
  })
  return {
    title
  }
}

export default useTitle
